﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title></title>
    <script type="text/javascript" src="HtmlCss/jquery-3.7.1.min"></script>
    <link type="text/css" rel="styleSheet" href="HtmlCss/MyStyle.css" />
</head>
<body>
    <!--
        1、用户登录
           默认用户名：admin，初始密码：admin
        2、检测登录用户是否是admin，用户密码是否是admin
           是，弹出更改用户名和密码页面
           否，进入主页面（index.html）
    -->

    <div id="login_box">
        <p /><p /><p />
        <h2>LOGIN</h2>
        <div id="input_box">
            登录用户：<br />
            <input type="text" id="username" name="username" placeholder="请输入用户名">
        </div>
        <div class="input_box">
            用户密码：<br />
            <input type="password" id="password" name="password" placeholder="请输入密码">
        </div><br />
        <input class="button" id="loginbutton" name="loginbutton" onclick="denglu();" type="button" value="登陆" /><br>
    </div>
    <script type="text/javascript">
            var btn = document.getElementById("loginbutton");
        btn.onclick = function () {
            var username = document.getElementById("username").value;
            var password = document.getElementById("password").value;

            //核对用户名和密码
            $.ajax({
                url: '../ashxs/IsUserExist.ashx',
                type: 'GET/POST',
                dataType: 'json',
                success: function (res) {
                    // 成功处理逻辑
                },
                error: function (res) {
                    // 错误时处理逻辑
                }
            });
            if (username == "admin" && password == "admin") {

                window.location.href = "../Login/EditPassWord.html";
            } else {
                //核对密码，打开主页
                alert("打开主页");
                window.location.href = "../Index.aspx";
            }


            }  

        
    </script>

</body>

</html>